package info.jimao.newsdk.callbacks;

import com.zhy.http.okhttp.callback.Callback;

import info.jimao.newsdk.results.SingleDataResult;
import okhttp3.Call;
import okhttp3.Response;

public abstract class SingleDataCallback<T> extends Callback<SingleDataResult<T>> {
    private Class<T> resultDataType;

    public SingleDataCallback(Class<T> resultDataType) {
        this.resultDataType = resultDataType;
    }

    @Override
    public SingleDataResult<T> parseNetworkResponse(Response response) throws Exception {
        String responseString = response.body().string();
        return new SingleDataResult<T>(responseString, resultDataType);
    }

    @Override
    public void onError(Call call, Exception e) {

    }

    @Override
    public void onResponse(SingleDataResult<T> response) {

    }
}
